//: Playground - noun: a place where people can play

import UIKit

var str = "Hello, playground"

private let LNErrorDomainName  = "com.itheima.error.network"
private enum LNNetworkErro: Int {
    case emptyDataError = -1
    case emptyTokenError = -2
    
/// 错误描述
    private var errorDescrption: String {
        
        switch self {
        case .emptyDataError: return "空数据"
        case .emptyTokenError: return "Token 为空"
        }
    }
/// 根据枚举类型，返回对应的错误
        private func error() -> NSError {
        
            return NSError(domain: LNErrorDomainName, code: rawValue, userInfo: [LNErrorDomainName: errorDescrption])
        }
        
    }
print(LNNetworkErro.emptyTokenError.error())
print(LNNetworkErro.emptyDataError.error())